using System;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.TTC
{
	internal class TTCRowHeader : TTCMessage
	{
		private short m_flags;

		internal int m_noOfRequests;

		internal int m_iterationNumber;

		internal int m_noOfIterations;

		private int m_uacBufferLength;

		internal TTCRowHeader(MarshallingEngine mEngine)
			: base(mEngine, 6)
		{
		}

		internal void ReadMessage(TTCRowData rowData)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131328, OracleTraceClassName.TTCRowHeader, OracleTraceFuncName.ReadMessage);
			}
			try
			{
				m_flags = m_marshallingEngine.UnmarshalUB1();
				m_noOfRequests = m_marshallingEngine.UnmarshalUB2();
				m_iterationNumber = (int)m_marshallingEngine.UnmarshalUB4();
				m_noOfRequests += m_iterationNumber * 256;
				m_noOfIterations = (int)m_marshallingEngine.UnmarshalUB4();
				m_uacBufferLength = m_marshallingEngine.UnmarshalUB2();
				byte[] array = m_marshallingEngine.UnmarshalDALC(bIgnoreData: false, m_marshallingEngine.retLen);
				if (array != null)
				{
					byte[] array2 = new byte[m_marshallingEngine.retLen[0]];
					Buffer.BlockCopy(array, 0, array2, 0, m_marshallingEngine.retLen[0]);
					rowData.SetBitVector(array2);
				}
				m_marshallingEngine.UnmarshalDALC(bIgnoreData: true);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268566528, OracleTraceClassName.TTCRowHeader, OracleTraceFuncName.ReadMessage, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131584, OracleTraceClassName.TTCRowHeader, OracleTraceFuncName.ReadMessage);
				}
			}
		}

		internal void ReInitialize()
		{
			m_flags = 0;
			m_noOfRequests = 0;
			m_iterationNumber = 0;
			m_noOfIterations = 0;
			m_uacBufferLength = 0;
		}
	}
}
